import {setServer} from "@/utils/axios";
const request = setServer();

// 查询权限列表
export function listData(query) {
  return request({
    url: '/permission/list',
    method: 'get',
    params: query
  })
}

// 查询权限详细
export function getDetail(id) {
  return request({
    url: '/permission/' + id,
    method: 'get'
  })
}

// 查询按钮权限
export function getButtonLimit(id) {
  return request({
    url: '/permission/button/' + id,
    method: 'get'
  })
}

// 新增权限
export function addData(data) {
  return request({
    url: '/permission/',
    method: 'post',
    data: data
  })
}

// 修改权限
export function updateData(data) {
  return request({
    url: '/permission/',
    method: 'put',
    data: data
  })
}

// 删除权限
export function delData(id) {
  return request({
    url: '/permission/' + id,
    method: 'delete'
  })
}

// 查询权限下拉框数据
export function getSelect(data) {
  return request({
    url: '/permission/refer',
    method: 'get',
    params: data
  })
}

// 回显已勾选数据
export function getRolePermission(data) {
  return request({
    url: '/permission/role/' + data,
    method: 'get',
  })
}

// 查询角色树形菜单
export function getTree(data) {
  return request({
    url: '/permission/tree',
    method: 'get',
    params: data
  })
}

// 角色分配菜单
export function assignPermission(data) {
  return request({
    url: '/permission/role',
    method: 'post',
    params: data
  })
}

// 导出
export function exportPermission(data,type){
  return request({
    url:'/permission/download',
    method: 'post',
    params: data,
    responseType:type
  })
}

// 获取菜单(竖向/横向/双向)
export function getWebMenu(data) {
  return request({
    url: '/permission/menu',
    method: 'get',
    params: data
  })
}
